package com.rabbit.vo.req;

import com.rabbit.dto.PageInfoDTO;
import com.rabbit.validate.base.*;
import com.rabbit.validate.phone.Phone;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * <h1>用户管理相关请求封装</h1>
 *
 * @author zjw
 * @date 2022/1/14 15:45
 */
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@Data
public class UserReq extends PageInfoDTO {

    /**
     * 用户编号
     */
    @NotNull(message = "用户编号不能为空", groups = {Delete.class, Update.class, Enable.class, UpdatePwd.class})
    private Long userId;

    /**
     * 登录账号
     */
    @NotEmpty(message = "账号不能为空", groups = {Insert.class, Update.class})
    private String loginAccount;

    /**
     * 用户昵称
     */
    @NotEmpty(message = "昵称不能为空", groups = {Insert.class, Update.class})
    private String userName;

    /**
     * 用户邮箱
     */
    @NotEmpty(message = "昵称不能为空", groups = {Insert.class, Update.class})
    @Email(message = "请填写正确的邮箱", groups = {Insert.class, Update.class})
    private String email;

    /**
     * 手机号码
     */
    @NotEmpty(message = "手机号不能为空", groups = {Insert.class, Update.class})
    @Phone(message = "请填写正确的手机号", groups = {Insert.class, Update.class})
    private String phone;

    /**
     * 用户性别（0男 1女 2未知）
     */
    @NotNull(message = "用户性别不能为空", groups = {Insert.class, Update.class})
    private Integer gender;

    /**
     * 头像路径
     */
    private String avatar;

    /**
     * 帐号状态 是否启用（1启用 0禁用）
     */
    private Boolean isEnabled;

    /**
     * 密码
     */
    @NotEmpty(message = "密码不能为空", groups = {UpdatePwd.class})
    private String password;

    /**
     * 操作人姓名
     */
    private String operatorUserName;

    /**
     * 角色清单
     */
    @NotEmpty(message = "角色不能为空", groups = {Insert.class, Update.class})
    private List<Long> roleIds;
}
